import { useState } from "react"
import PropTypes from 'prop-types'
const DemoStateChild=(props)=>{
    const[ncount]=useState(()=>{
        if(props.initCount===1){
            return props.initCount+1
        }
        return props.initCount+5
    })
    return (<>
    child依赖父组件的count做一些逻辑
    props.initCount:{props.initCount}-ncount:{ncount}  
      </>)
}
DemoStateChild.propTypes={
    initCount:PropTypes.number.isRequired
}
export default DemoStateChild;